package cc.comac.saic.hkhy.jsrj.gj.inttools.async;

public enum AsyncTaskStatus {
    PENDING("PENDING", "等待中"),
    RUNNING("RUNNING", "执行中"),
    SUCCESS("SUCCESS", "成功"),
    FAILED("FAILED", "失败"),
    CANCELLED("CANCELLED", "取消");

    private final String code;
    private final String info;

    AsyncTaskStatus(String code, String info) {
        this.code = code;
        this.info = info;
    }

    public String getCode() {
        return code;
    }

    public String getInfo() {
        return info;
    }

    public static AsyncTaskStatus getByCode(String code) {
        for (AsyncTaskStatus status : values()) {
            if (status.getCode().equals(code)) {
                return status;
            }
        }
        return null;
    }
}
